package com.csst.action;


import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.csst.bean.Order;
import com.csst.service.OrderService;
import com.opensymphony.xwork2.ActionSupport;

@Controller
public class BankResultAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5072921746287986096L;
	
	private String result;
	private String orderID;
	
	@Resource
	private OrderService service;
	
	
	public String getOrderID() {
		return orderID;
	}

	public void setOrderID(String orderID) {
		this.orderID = orderID;
	}


	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	@Override
	public String execute() throws Exception {
		System.out.println(result);
		if(result.equals("SC")){
			Order order=new Order();
			System.out.println(orderID);
			order.setIdentNum(orderID);
			order= service.getOrder(order);
			System.out.println(order+"111111111111111111111111"+order.getOrderId());
			if(order!=null){
				order.setState(2);
				service.updateOrder(order);
			}
		}
		
		return SUCCESS;
		// TODO Auto-generated method stub
	}
	
	

}
